﻿// Learn more about F# at http://fsharp.net

open System.Xml
open System.IO
open System

//type Internal () =
//    member x.IntProp = 2
//    member x.GuidProp = Guid.NewGuid()
//
//type Test(v) =
//    member x.Str = "hihihi"
//    member x.Prop1 = v
//    member x.Intern = new Internal()
//    member x.Null : string = null
//    member x.List = new System.Collections.Generic.List<int>(seq { for i in 0..1 -> i })
//    member x.Seq = seq { for i in 0..10 -> i }
//
//let main () =
//    use writer = XmlWriter.Create("a.xml")
//    XSerialization.serialize writer (new Test(2))
//
//main ()

let t = typeof<string>

let (|OfType|_|) (t : Type) o = if o.GetType() = t then Some(o) else None

let o = (1 :> obj);
let st = typeof<string>
let it = typeof<int>

let T<'T> () = typeof<'T>

match o with
| OfType st o -> printfn "string"
| OfType it o -> printfn "int"
| _ -> printfn "hz"

match o with
| :? string as s -> printfn "string"
| :? int as i -> printfn "int"
| _ -> printfn "hz"

type MessagePriority = 
    | Low | Medium | High
type LogMessage = 
    | Message of MessagePriority * string
    | Warnin of int * string
    | Error of string * string * string